A Physically Based Shading material. More...
A Physically Based Shading material.
This material aims to represent surfaces using physically plausible equations. It became a standard over the years, thanks to the limited number of parameters it requires, while offering pleasant results.
nkAstraeus::PbsMaterial::PbsMaterial | ( | ) |
Constructor.
nkAstraeus::PbsMaterial::~PbsMaterial | ( | ) |
Destructor.
|
overridevirtual |
Implements nkAstraeus::Material.
nkMaths::Vector nkAstraeus::PbsMaterial::getLightDirection | ( | ) | const |
nkMaths::Vector nkAstraeus::PbsMaterial::getLightColor | ( | ) | const |
nkMaths::Vector nkAstraeus::PbsMaterial::getAlbedoColor | ( | ) | const |
nkMaths::Vector nkAstraeus::PbsMaterial::getSpecularColor | ( | ) | const |
nkMaths::Vector nkAstraeus::PbsMaterial::getEmissiveColor | ( | ) | const |
nkMaths::Vector nkAstraeus::PbsMaterial::getEnvironmentColor | ( | ) | const |
float nkAstraeus::PbsMaterial::getMetalness | ( | ) | const |
float nkAstraeus::PbsMaterial::getRoughness | ( | ) | const |
nkGraphics::Texture* nkAstraeus::PbsMaterial::getAlbedoTexture | ( | ) | const |
nkGraphics::Texture* nkAstraeus::PbsMaterial::getSpecularTexture | ( | ) | const |
nkGraphics::Texture* nkAstraeus::PbsMaterial::getEmissiveTexture | ( | ) | const |
nkGraphics::Texture* nkAstraeus::PbsMaterial::getMetalnessTexture | ( | ) | const |
nkGraphics::Texture* nkAstraeus::PbsMaterial::getRoughnessTexture | ( | ) | const |
nkGraphics::Texture* nkAstraeus::PbsMaterial::getNormalMapTexture | ( | ) | const |
nkGraphics::Texture* nkAstraeus::PbsMaterial::getEnvironmentTexture | ( | ) | const |
nkGraphics::Texture* nkAstraeus::PbsMaterial::getIrradianceTexture | ( | ) | const |
THREE_CHANNEL_PACK nkAstraeus::PbsMaterial::getAlbedoTextureChannels | ( | ) | const |
THREE_CHANNEL_PACK nkAstraeus::PbsMaterial::getSpecularTextureChannels | ( | ) | const |
THREE_CHANNEL_PACK nkAstraeus::PbsMaterial::getEmissiveTextureChannels | ( | ) | const |
ONE_CHANNEL_PACK nkAstraeus::PbsMaterial::getMetalnessTextureChannels | ( | ) | const |
ONE_CHANNEL_PACK nkAstraeus::PbsMaterial::getRoughnessTextureChannels | ( | ) | const |
THREE_CHANNEL_PACK nkAstraeus::PbsMaterial::getEnvironmentTextureChannels | ( | ) | const |
THREE_CHANNEL_PACK nkAstraeus::PbsMaterial::getIrradianceTextureChannels | ( | ) | const |
bool nkAstraeus::PbsMaterial::getEnvironmentTextureIsCubeByDefault | ( | ) | const |
bool nkAstraeus::PbsMaterial::getIrradianceTextureIsCubeByDefault | ( | ) | const |
void nkAstraeus::PbsMaterial::setLightDirection | ( | const nkMaths::Vector & | value | ) |
Sets the light direction to use within the material. Currently, the only type of light supported is directional.
value | The direction of the light. |
void nkAstraeus::PbsMaterial::setLightColor | ( | const nkMaths::Vector & | value | ) |
Sets the color to use for the directional light when it is active.
value | The light color. |
void nkAstraeus::PbsMaterial::setAlbedoColor | ( | const nkMaths::Vector & | value | ) |
Sets the constant albedo (diffuse) color to use on the whole surface.
value | The albedo color to use. |
void nkAstraeus::PbsMaterial::setSpecularColor | ( | const nkMaths::Vector & | value | ) |
Sets the constant specular (reflections) color to use on the whole surface.
value | The specular color to use. |
void nkAstraeus::PbsMaterial::setEmissiveColor | ( | const nkMaths::Vector & | value | ) |
Sets the constant emissive color to use on the whole surface.
value | The emissive color to use. |
void nkAstraeus::PbsMaterial::setEnvironmentColor | ( | const nkMaths::Vector & | value | ) |
Sets a constant environment color. Can be seen as an ambient lighting.
value | The color to use. |
void nkAstraeus::PbsMaterial::setMetalness | ( | float | value | ) |
Sets the metalness of the material. Metalness is a factor between [0.0, 1.0], encoding how metallic the material should be. At 0, the material is dialectric, while at 1, it's fully metallic. Globally, at higher metallic level, the material will be more reflective.
value | The constant metalness to use on the whole surface. |
void nkAstraeus::PbsMaterial::setRoughness | ( | float | value | ) |
Sets the roughness of the material. Roughness is a factor between [0.0, 1.0], encoding how rough the material should be. At 0, the material is very smooth, while at 1, it is full of small rough patches. Low roughness values mean that the material will have clear reflections. As it goes higher, the reflections get blurrier.
value | The constant roughness to use on the whole surface. |
void nkAstraeus::PbsMaterial::setAlbedoTexture | ( | nkGraphics::Texture * | value, |
THREE_CHANNEL_PACK | channels = THREE_CHANNEL_PACK::RGB |
||
) |
Sets the albedo (diffuse) color to use by using a texture that will be sampled using meshes texture coordinates.
value | The texture to use as albedo. |
channels | The texture channels the data is encoded in. Defaults to sample the RGB channels. |
void nkAstraeus::PbsMaterial::setSpecularTexture | ( | nkGraphics::Texture * | value, |
THREE_CHANNEL_PACK | channels = THREE_CHANNEL_PACK::RGB |
||
) |
Sets the specular (reflections) color to use by using a texture that will be sampled using meshes texture coordinates.
value | The texture to use as specular. |
channels | The texture channels the data is encoded in. Defaults to sample the RGB channels. |
void nkAstraeus::PbsMaterial::setEmissiveTexture | ( | nkGraphics::Texture * | value, |
THREE_CHANNEL_PACK | channels = THREE_CHANNEL_PACK::RGB |
||
) |
Sets the emissive color to use by using a texture that will be sampled using meshes texture coordinates.
value | The texture to use as emissive. |
channels | The texture channels the data is encoded in. Defaults to sample the RGB channels. |
void nkAstraeus::PbsMaterial::setMetalnessTexture | ( | nkGraphics::Texture * | value, |
ONE_CHANNEL_PACK | channel = ONE_CHANNEL_PACK::A |
||
) |
Sets the metalness to use by using a texture that will be sampled using meshes texture coordinates.
value | The texture to use as albedo. |
channel | The texture channel the data is encoded in. Defaults to sample the A channel. |
void nkAstraeus::PbsMaterial::setRoughnessTexture | ( | nkGraphics::Texture * | value, |
ONE_CHANNEL_PACK | channel = ONE_CHANNEL_PACK::A |
||
) |
Sets the roughness to use by using a texture that will be sampled using meshes texture coordinates.
value | The texture to use as albedo. |
channel | The texture channel the data is encoded in. Defaults to sample the A channel. |
void nkAstraeus::PbsMaterial::setNormalMapTexture | ( | nkGraphics::Texture * | value, |
THREE_CHANNEL_PACK | channels = THREE_CHANNEL_PACK::RGB |
||
) |
Sets the normal map texture to use for normal mapping.
value | The texture to use as the normal map. |
channels | The texture channels the data is encoded in. Defaults to sample the RGB channels. |
void nkAstraeus::PbsMaterial::setEnvironmentTexture | ( | nkGraphics::Texture * | value, |
THREE_CHANNEL_PACK | channels = THREE_CHANNEL_PACK::RGB , |
||
bool | prefilteredEnv = false |
||
) |
Sets the environment map to use. Giving a texture enables the Image Based Lighting functionality of the material for specular reflections. The texture can be either :
If the texture is unloaded when the material's load() method is called, the assumed texture type will be the one given by the setEnvironmentTextureIsCubeByDefault() function.
value | The texture to use as the environment. |
channels | The texture channels the data is encoded in. Defaults to sample the RGB channels. |
prefilteredEnv | Whether the texture given is prefiltered (true) or not (false). If true, the material will use the split-sum optimization to improve performances. |
void nkAstraeus::PbsMaterial::setIrradianceTexture | ( | nkGraphics::Texture * | value, |
THREE_CHANNEL_PACK | channels = THREE_CHANNEL_PACK::RGB |
||
) |
Sets the irradiance map to use. Irradiance corresponds to the diffuse lighting from the environment, the average light incoming on the surface for any given direction. The texture can be either :
If the texture is unloaded when the material's load() method is called, the assumed texture type will be the one given by the setIrradianceTextureIsCubeByDefault() function.
value | The texture to use as the irradiance map. |
channels | The texture channels the data is encoded in. Defaults to sample the RGB channels. |
void nkAstraeus::PbsMaterial::setEnvironmentTextureIsCubeByDefault | ( | bool | value | ) |
Sets whether the environment texture given should be expected as a cube map or not, when it is unloaded while the material is loading.
value | Whether an unloaded texture should be expected as a cube map (true) or not (false). |
void nkAstraeus::PbsMaterial::setIrradianceTextureIsCubeByDefault | ( | bool | value | ) |
Sets whether the irradiance texture given should be expected as a cube map or not, when it is unloaded while the material is loading.
value | Whether an unloaded texture should be expected as a cube map (true) or not (false). |
|
overridevirtual |
See Material::load().
Implements nkAstraeus::Material.
|
overridevirtual |
See Material::unload().
Implements nkAstraeus::Material.